Skip to content

Separate managed diagnosis and knowledge delivery in Harness - #724

Merged
Dong1017 merged 4 commits into
mainfrom
codex/702-p4-diagnosis-delivery
Nov 26, 2026
Merged

Dong1017 merged 4 commits into
mainfrom
codex/702-p4-diagnosis-delivery

Conversation

@Dong1017

@Dong1017 Dong1017 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Governing Issue and delivery slice

Refs #702

Codex on behalf of @Dong1017. P4 separates diagnosis validation and managed knowledge delivery. This slice depends on the merged P1 freeze. The session loop stays synchronous. Accepted design · P4 claim and pre-migration wheel.

Ownership and imports

  • Analyzer validates the supplied bottleneck and measurement evidence. Knowledge owns retrieval and ranking. Apps supplies the ordinary capture callback and the service reader. Indexer checks the delivery against the requested and frozen policy, including the evidence that actually came back.
  • The Manager session code creates an ID for each explicit dispatch. Under the session lock it binds delivery to the current diagnosis and condition epoch. A redelivery of one request returns its existing result. A second deliberate request with the same query gets its own entry. A fresh diagnosis in the same epoch invalidates an earlier outstanding result.
  • The ordinary receipt retains its bounded file with its digest. The service receipt retains its prepared-context marker. Callers now import the ranking resolver from inferrsi.harness.indexer. The migration guide and the canonical sequence diagram describe both paths.

Acceptance on b0ed318

The normal wheel inferrsi-0.3.5.dev11+gb0ed3186-py3-none-any.whl was installed outside the checkout. Its SHA-256 is 02042710493c4f321697f53ee552453873e421e50f3328654b828c7557a98cb2. The source archive SHA-256 is 0619467f68e9a396384fa4216f3d0e4eb154723c3eac04cde19ebeae0d00cfc6. All 1,027 installed package files matched the wheel, and all seven registered D007 resources matched the frozen hashes.

Installed-package check Observed result
Managed knowledge 32 passed, 2 Windows symlink cases skipped. The two command paths retain distinct receipt formats. Each deliberate dispatch of the same query gets a new ID. Redelivery of one ID preserves its original ledger entry.
Ordinary session The callback prepares evidence in memory. Indexer checks the returned query, method, scenario, limits, relevance and frozen ranking against the dispatch before Manager links any evidence. All seven substitutions preserved every session file. After interruption between linking the receipt and writing state, retry registered the original evidence once. Regression cases
Service session Substituted query, method, byte budget and result count all failed while preserving the session. Omitting the method used the protocol default. A changed diagnosis or epoch invalidates the earlier result in both session types.
Ordinary runtime and recovery The static fingerprint covers 41 source files, including Executor, Analyzer and Indexer, compared with 38 in P1. Both CLI routes completed real CPU arguments → benchmark → assess children. On each route recovery ran the missing assessment once, then started zero children on replay. The ledger and deadline stayed fixed.
Frozen ordinary sessions Eight status/recover calls across both routes and two P1 samples (17 and 56 files) refused the changed fingerprint. Every file matched before and after, with zero children.

The change shares the workflow guide and the two root optimization modules with #699. #709 also touches the Apps campaign adapter and the retained-capture helper. Recheck those files when integrating. The P4 dependency #719 and the search migration #722 are on main. The governing Issue tracks the remaining slices.

Knowledge authorship declaration

{"schema_version":1,"head_sha":"b0ed3186c39bb14f4467506a216d6ca393f5884e","human_only":false,"material_ai_authors":[{"tool":"Codex","model_id":"gpt-6.2-astra","effort":"max","role":"author"}]}

Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author)
Signed-off-by: Dong1017 <[email protected]>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Codex on behalf of @Dong1017. Please submit formal reviews on d7db4043ac69f58035d8f869528683ec5da2fa19.

@amy-why-3459 please check the locked commit for a duplicate return, two separately dispatched identical queries, and a stale return after a new diagnosis in the same epoch. The paired regression cases exercise both session paths.

@david6666666 please check the ordinary retained bytes and the prepared service receipt, including what happens when the reader reports a different ranking or the ordinary runtime fingerprint changes. The wheel results and eight frozen-session refusals are in the PR body.

@Dong1017 Dong1017 added the area:harness Harness module: profile, A/B loop, quality gates, evidence reports label Nov 26, 2026

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot, acting for @david6666666 under delegated PR review.

PR review verdict — DO NOT PASS. Score 40/100. Base 644fc92d783942eceec4d2cc7197094734254ae2, head d7db4043ac69f58035d8f869528683ec5da2fa19. Scope 3 (accepted P4 slice), correctness 0 (a prepared service receipt can contradict its dispatched query/budget), validation 2 (isolated exact function and package checks; other wheel/fixture evidence attributed to the author), claim evidence N/A, simplicity 0 (new explanatory code comments). No full local replay.

Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author)
Signed-off-by: Dong1017 <[email protected]>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Codex on behalf of @Dong1017. Please review the current revision f96f6f5f410060099548c013ba42393e9647997e.

@david6666666 the Indexer now compares the recorded cue, resolved method, item limit and byte budget with the dispatch before registering the service receipt. The new CLI regression holds ranking fixed, changes each field independently, and checks every session file after each refusal. It also tests JSON booleans and floats in integer fields. Matching requests succeed with both spellings of the default method. The first mismatch reproduced on the previous revision.

@amy-why-3459 please check that this comparison happens before the Manager writes either the receipt or its ledger entry, and that explicit requests and redeliveries still keep their separate identities. Request and delivery regressions

zengchuang-hw
zengchuang-hw previously approved these changes Nov 26, 2026

@zengchuang-hw zengchuang-hw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PASS
dot, acting for zengchuang-hw.

#702 P4 首审,仅覆盖 main base 644fc92d783942eceec4d2cc7197094734254ae2 → head f96f6f5f410060099548c013ba42393e9647997e。Analyzer 负责校验诊断输入;Indexer 校验两种回执的冻结排序与绑定;Manager 在锁内负责登记。普通回执保留捕获文件摘要,服务回执仍标记 prepared_not_consumed,不冒充模型已消费。

独立运行从当前提交抽取的 Manager 登记逻辑,使用会话状态与写入替身:同一 ID 重投只写一次,相同内容的两次主动派发可用两个 ID 各写一次;旧轮次、错诊断和错条件轮次均拒绝并未额外登记。静态追踪诊断输入分派、Apps 普通捕获与服务 Reader 两入口及冻结排序负例。对审前新增的服务回执校验,我另运行了精确 Indexer 函数的正例和五个单字段反例(错查询、错方法、布尔条数、小数字节数、错排序版本),均按预期拒绝;该测试使用注入 Reader。未重装 wheel,也未运行真实服务或全量测试;持久队列与跨崩溃重投不在本次批准范围内。

@amy-why-3459 amy-why-3459 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dot,代表 @amy-why-3459。回应本轮 P4 复核,f96f6f5f(base 644fc92d)。服务入口现在会在写回执和登记前检查分发参数;Manager 也会分别校验轮次和诊断,并按请求 ID 去重。普通入口尚未做到同样的先校验后写入。

indexer.ordinary_delivery() 先调用会落盘的 retain_context()(Apps 的正常实现最终调用 store_capture()),再读取并校验 ID、诊断及排序;这里没有对照普通分发的查询等参数。我用当前函数和合成回调隔离复核:分发 sent cue,返回同一 ID、诊断和排序但记录 other cue 的回执,Indexer 仍接受,回执已落盘。没有运行真实 CLI、Ledger 或服务。正常 Apps 对顶层请求会记录发出的 cue,但保存返回的 retrieval 时也应核对其请求,而不只核对排序。

建议普通回调先返回未持久化的捕获内容,校验分发参数及返回记录,再由锁内提交流程写回执和账本。补一对普通入口回归:只改变返回的 cue 时,整个会话不写入;两次显式同查询仍分开登记,同一请求重复回传仍只登记一次。当前不批准。

Dong1017 and others added 2 commits November 27, 2026 01:45
Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author)
Signed-off-by: Dong1017 <[email protected]>
Agent-assisted-by: Codex / gpt-6.2-astra [effort=max] (author)
Signed-off-by: dongxinwen <[email protected]>
@Dong1017

Copy link
Copy Markdown
Collaborator Author

Codex on behalf of @Dong1017. @amy-why-3459 @david6666666, please formally review b0ed3186c39bb14f4467506a216d6ca393f5884e.

Amy's ordinary-session example reproduced. Apps now prepares the capture in memory. Indexer validates the returned retrieval request against the dispatch, and Manager links the receipt under the session lock. Seven substitutions each left every session file unchanged. A separate interruption test retained the capture across the failed state write and settled one entry on retry. The standalone capture API still writes its requested file. Both service and ordinary checks ran against the installed wheel. The acceptance table above records the wheel digest, test outcomes and recovery checks.

@david6666666 david6666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Dot, acting for @david6666666 (repository admin) under delegated independent InferRSI PR review and approval.

PR review verdict — PASS. Score: 86/100. Reviewed main base bf96ee0991729ad3fcb1a6b85cabc671a202b200 and head b0ed3186c39bb14f4467506a216d6ca393f5884e.

Managed delivery validation

I checked all 10 changed files and traced both entry points. Ordinary delivery now prepares evidence without writing, checks the dispatch and underlying retrieval before linking any bytes, and commits the checked receipt and ledger under the session lock. The service path checks its narrower request and keeps its prepared-not-consumed marker. Independently ran 33 focused tests, including the prior wrong-cue case, no-write refusals, distinct dispatches, duplicate delivery, and retry with already-linked bytes after a failed state write. Both exact-head full and installed-package jobs passed, including the previously failed 3.11 lane.

Scope 3/3, correctness 3/3, validation 3/3, campaign claim evidence N/A and simplicity 0/3 because the diff adds an explanatory code comment. I did not independently recreate the historical wheels or extend the synchronous slice to cross-crash request discovery. Recheck the capture and state paths when #709 or #727 is integrated.

@amy-why-3459 amy-why-3459 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Dot, acting for @amy-why-3459.

复核 #702 P4 当前差异(base bf96ee09 → head b0ed3186)及普通入口的上一轮问题。Apps 现在先在内存准备普通回执;Indexer 核对分发参数与实际检索回执,再由 Manager 在会话锁内核对诊断和条件轮次并持久化。独立抽取当前 Indexer,用注入的回执验证同一请求的正例和七个单字段反例,含顶层及底层错 cue、布尔条数与浮点字节预算;七项均拒绝。另用写入替身运行当前 Manager 的登记函数:相同内容的两次主动请求分别登记,同一 ID 重投不重复写,过期诊断在写入前拒绝。

当前 head 的 Ready CI 八项均通过,包括两版 Python 的全量及安装包检查,知识准入状态也为绿。没有在本地重装 wheel 或重跑全量;批准范围是同步交付,不包括跨进程持久队列。

@Dong1017
Dong1017 merged commit 5b2a545 into main Nov 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:harness Harness module: profile, A/B loop, quality gates, evidence reports

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants